~=Readme=~
----------
Dnetc ctrl service is the service for the Dnetc Ser Ctrl (v2.0.1.x). It parses the log file of the distributed.net client and when asked serves it up.
Also does some commands fetch/flush/(un)install...

Currently communicates on port 2828

Interesting commands: help & html & unloadme ;)
Open a browser, type the ip where the service is running add :2828/html after it and be amazed (not really).

Just start the service up and it will run or use --install to install it as a service (--uninstall to remove it)

Greetings Damic

Known bugs:
-----------
*nothing* it's refactored with ai so no guarantees

Future:
-------
- convert from .NET Framework to .NET

Testing:
--------
*nothing*

~=Change Log=~
--------------
V. 26.09.12.0 (12/09/2026)
--------------------------
Did a re-factor with Claud.ai:
 - Core is updated to 3.00
 - included the new dnetbufferreader part so buffer values are always read ;)
 - Pause function whas a little funky sometimes, mostly recovers but sometimes not.
 - Made it a real service (use --install/--uninstall)
 - updateme is now fully incorporated
 - Basic Control Panel interfacing is done

V. 26.08.10.0 (10/08/2026)
--------------------------
Removed: Rewrite the current Core as a class >> since only 1 program uses it I don't see what kind of advantage it would be.
Add: new tag "html", so you can see in what state the service is (it's a nice self updating webpage)
Add: UpdateMe, it is now possible to update the server from the client
Fix: better debug logging (log swells hard on a day)
Fix: empty data when the log is very fast updated >> FillWorkLines() would sometimes give a hold of 2 minutes, now reduced to 15s

V. 26.03.02.0 (02/03/2026)
--------------------------
Refix: sometimes it just stays in a loop and doesn't update or takes a long time
Fix: empty data when the log is very fast updated

V. 26.02.26.0 (26/02/2026)
--------------------------
reFix: gpu driver crash detection

V. 25.12.25.0 (25/12/2025)
--------------------------
Refix: sometimes it just stays in a loop and doesn't update or takes a long time
Core update to 2.89
 - Checklines() added an extra return
 - made small changes so debugging is easier 

V. 25.12.21.0 (21/12/2025)
--------------------------
Refix: sometimes it just stays in a loop and doesn't update or takes a long time
Core update to 2.88
 - stage 1 parser: refactored + added 2 more exceptions to the list
 - Rewritten:
   - cleanup_Log_File
   - FillWorkLines
   - ParseDnetcTime

V. 25.12.12.0 (12/12/2025)
--------------------------
Fix: starting a new log file on the wrong date (usage of date.utcnow)

V. 25.11.23.0 (23/11/2025)
--------------------------
Upd: No internet / yes internet detection
Upd: better handling when there's no dnetc client running

V. 25.11.22.0 (22/11/2025)
--------------------------
Upd: the way I handle all distributed.net clients (main/is fetching/is updating/is flushing)
Fix: write to debug log wasn't writing every minute, only when program was closed

V. 25.11.02.0 (02/11/2025)
--------------------------
Upd: Newtonsoft.Json to 13.0.3
Add: new datatype in the "info"-tag: "DataVersion", this is for future use to see what the controller can set in the service.
Fix: on gpu driver crash, it would try to fetch on and on and on
Fix: possible empty LogFileContents to work with
 
V. 24.12.25.0 (25/12/2024)
--------------------------
Add: extra log info if there are multiple clients running when fetching/flushing
Chg: key/s check has now the fetch command

Upd: Core 2.85: funky log with multiple sends after each other, would not be counted

V. 24.12.18.0 (18/12/2024)
--------------------------
Chg: DebugWriter() class has it's own timer now and will write the log dump on it's own time
Chg: cleaned up code that already was commented out
Chg: ControllerRunning() renamed to OldControllerRunning()
Chg: key/s check has now a 30s wait timer, 5 seconds whas to short

V. 24.12.08.0 (08/12/2024)
--------------------------
Add: Check if keys/s between last wu calculated summary isn't to far of. If yes then the dnet client will be restarted
Fix: possible string/integer problem

Core update to 2.84
 Fix: Get_Stats_Units() wouldn't parse a correct line, so stats units where 0
 Fix: possible null references

V. 24.11.26.0 (26/11/2024)
--------------------------
Add: Log watching function, so it doesn't need a timed event

V. 24.11.12.0 (12/11/2024)
--------------------------
Removed the tcp jungle that I've written and replaced it with a HttpClient() so it's now a "web server" on port 2828.
If you browse to the server without a command, it will always give back a JSON message stating: "Command not recognized, try help for all the commands"

Fix: Service log file upload
Fix: DNETc log file upload

V. 24.11.05.0 (05/11/2024)
--------------------------
Core update to 2.83
 Chg: added a time check if the parsers couldn't get a lock
 Chg: Internet check has now additional checks as is the network avaible and now 3 sites to ping instead of 2 (cd-pc.be/distributed.net/cloudflare.com) before it returns false

Add: new setting "siteping". Normaly the service will try to ping cd-pc.be/distributed.net/cloudflare.com, but sometimes you want it to ping somewhere else (internal server/pc)
Add: version information when launching or ending the Service to the log file
Add: TCP file sending/receiving (max 8.2MB files)
Add: Service log file upload
Add: new command to get all the buffer filenames
Fix: DNETc log file upload (makes copy first en then starts uploading)
Fix: Could hang sometimes if the DNET client is rapidly writing to the logfile
 >> Add: when trying to fetch and has no internet, then the dnet client will set to pause and when internet is back, it will try to fetch and unpaused the client
 >> Chg: how the log file is read
 >> Chg: in the backgroundworker/timer checking

V. 24.09.26.0 (26/09/2024)
--------------------------
Chg: when taking a backup, date & time will be included, so you don't lose anything ;)
Chg: when in MF mode and "Rename outputbuffer" is enabled date & time will be included in the filename

V. 24.04.03.0 (03/04/2024)
--------------------------
Chg: some code made better
Chg: "?help" commands are now alphabeticly
Chg: start and stop of the dnet client are now handled better (i.e. more sneaky)
Fix: check to see if the client is running or not before we try the (un)pause/fetch/flush
Fix: low buffer test
Fix: read error fix >> restart tcpclient
Fix: some typo's in this changelog

V. 24.03.14.1 (14/03/2024)
--------------------------
Chg: when comparing a string, set the string to lower first (i.e. settings)
Chg: some code cleanups
Fix: automated pause would pause the client when there is no data

V. 23.06.19.0 (19/06/2023)
--------------------------
Fix: output-buffer not found
Fix: Timer: No dnetc ini found on path: [...]
Fix: do stuff when not needed
Add: new megaflush setting: rename output buffer when reaching a amount

V. 23.06.07.5 (07/06/2023)
--------------------------
First release

